import { createRouter, createWebHashHistory } from 'vue-router'
import index from '../components/index.vue'

// 使用动态导入组件
const News = () => import('../components/News.vue')
const Products = () => import('../components/Products.vue')
const Audiovisual = () => import('../components/Audiovisual.vue')
const My = () => import('../components/My.vue')

const routes = [
  {
    path: '/',
    name: 'Index',
    component: index
  },
  {
    path: '/news',
    name: 'News',
    component: News
  },
  {
    path: '/products',
    name: 'Products',
    component: Products
  },
  {
    path: '/audiovisual',
    name: 'Audiovisual',
    component: Audiovisual
  },
  {
    path: '/My',
    name: 'My',
    component: My
  }
]

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes
})

export default router
